<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:t="http://xbrl.org/formula/conformance/example" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2008-02-06T12:55:00" />
    </reg:owner>
  </owners>

  <number>90310</number>

  <name>xfi:fact-typed-dimension-value</name>

  <documentation>
  </documentation>

  <reference
    xlink:type="simple"
    xlink:href="90310 xfi.fact-typed-dimension-value function.xml">
    function definition
  </reference>

  <variation id="V-01">
    <name>Height dimension for Mount Kilimanjaro</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-explicit-dimension-value.xsd"/>
      <linkbase xlink:type="simple" xlink:href="fact-explicit-dimension-value-definition.xml"/>
      <instance readMeFirst="true" id="V01" xlink:type="simple" xlink:href="fact-explicit-dimension-value-instance1.xml"/>
      <cfcn:call file="V01">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:Peak[./text() eq 'Mount Kilimanjaro'], 
          QName('http://xbrl.org/formula/conformance/example','t:HeightDimension')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count( $result ) eq 1 and
         count( $result/* ) eq 1 and
         $result/*[1] instance of element(t:peakHeight,xs:integer) and
         data( $result/*[1] ) instance of xs:integer and
         $result/t:peakHeight eq xs:integer(5963)
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-02">
   <name>Height dimension for pre-eruption volcano (whose hypercube lacks the location dimension because the volcano is not erupted yet, but it has alternate link roles allowing height to be added later after erupting)</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-explicit-dimension-value.xsd"/>
      <linkbase xlink:type="simple" xlink:href="fact-explicit-dimension-value-definition.xml"/>
      <instance readMeFirst="true" id="V02" xlink:type="simple" xlink:href="fact-explicit-dimension-value-instance1.xml"/>
      <cfcn:call file="V02">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:Peak[./text() eq 'Pre-eruption volcano'], 
          QName('http://xbrl.org/formula/conformance/example','t:HeightDimension')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         empty( $result )
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
   <name>Height dimension for SpacePhenomenon concept Wormhole (whose hypercube for space warping can never have the height dimension)</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-explicit-dimension-value.xsd"/>
      <linkbase xlink:type="simple" xlink:href="fact-explicit-dimension-value-definition.xml"/>
      <instance readMeFirst="true" id="V03" xlink:type="simple" xlink:href="fact-explicit-dimension-value-instance1.xml"/>
      <cfcn:call file="V03">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:SpacePhenomenon[1], 
          QName('http://xbrl.org/formula/conformance/example','t:HeightDimension')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         empty( $result )
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Error of concept argument which is not a dimension</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-explicit-dimension-value.xsd"/>
      <linkbase xlink:type="simple" xlink:href="fact-explicit-dimension-value-definition.xml"/>
      <instance readMeFirst="true" id="V04" xlink:type="simple" xlink:href="fact-explicit-dimension-value-instance1.xml"/>
      <cfcn:call file="V04">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:Peak[./text() eq 'Mount Kilimanjaro'], 
          QName('http://xbrl.org/formula/conformance/example','t:Mars')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:invalidTypedDimensionQName</error>
    </outputs>
  </variation>

  <variation id="V-05">
    <name>Error of non-XBRL element argument as dimension argument</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-explicit-dimension-value.xsd"/>
      <linkbase xlink:type="simple" xlink:href="fact-explicit-dimension-value-definition.xml"/>
      <instance readMeFirst="true" id="V05" xlink:type="simple" xlink:href="fact-explicit-dimension-value-instance1.xml"/>
      <cfcn:call file="V05">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:Peak[./text() eq 'Mount Kilimanjaro'], 
          QName('http://xbrl.org/formula/conformance/example','t:nonXbrlElement')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:invalidTypedDimensionQName</error>
    </outputs>
  </variation>

  <variation id="V-06">
    <name>Raises an error for an attribute declaration argument</name>
    <documentation>
      <xhtml:p>
        Tests that error is detected when the concept name argument declares an attribute.
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-explicit-dimension-value.xsd"/>
      <linkbase xlink:type="simple" xlink:href="fact-explicit-dimension-value-definition.xml"/>
      <instance readMeFirst="true" id="V06" xlink:type="simple" xlink:href="fact-explicit-dimension-value-instance1.xml"/>
      <cfcn:call file="V06">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:Peak[./text() eq 'Mount Kilimanjaro'], 
          QName('http://xbrl.org/formula/conformance/example','t:anAttribute')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:invalidTypedDimensionQName</error>
    </outputs>
  </variation>

  <variation id="V-07">
    <name>Raises an error for an xbrli namespace&apos;ed argument</name>
    <documentation>
      <xhtml:p>
        Tests that error is detected when the concept qname is xbrli:item
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-explicit-dimension-value.xsd"/>
      <linkbase xlink:type="simple" xlink:href="fact-explicit-dimension-value-definition.xml"/>
      <instance readMeFirst="true" id="V07" xlink:type="simple" xlink:href="fact-explicit-dimension-value-instance1.xml"/>
      <cfcn:call file="V07">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:Peak[./text() eq 'Mount Kilimanjaro'], 
          QName('http://xbrl.org/formula/conformance/example','xbrli:item')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:invalidTypedDimensionQName</error>
    </outputs>
  </variation>

  <variation id="V-08">
   <name>Dimension can be located in either segment or scenario, for this variation appears in the segment, to test that function is looking in either location for value.</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="bi-locational-dim-concepts.xsd"/>
      <linkbase xlink:type="simple" xlink:href="bi-locational-dim-definition.xml"/>
      <instance readMeFirst="true" id="V08" xlink:type="simple" xlink:href="bi-locational-seg-typed-instance.xml"/>
      <cfcn:call file="V08">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:PriItem1[1], 
          QName('http://xbrl.org/formula/conformance/example','t:TypedDim1')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count( $result ) eq 1 and
         count( $result/* ) eq 1 and
         $result/*[1] instance of element(t:typedDim1Value,xs:string) and
         data( $result/*[1] ) instance of xs:string and
         $result/t:typedDim1Value eq 'dimVal1'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-09">
   <name>Dimension can be located in either segment or scenario but for this variation appears in the scenario instead of segment, to test that function is looking in either location for value.</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="bi-locational-dim-concepts.xsd"/>
      <linkbase xlink:type="simple" xlink:href="bi-locational-dim-definition.xml"/>
      <instance readMeFirst="true" id="V09" xlink:type="simple" xlink:href="bi-locational-scen-typed-instance.xml"/>
      <cfcn:call file="V09">
        xfi:fact-typed-dimension-value(
          /xbrli:xbrl/t:PriItem1[1], 
          QName('http://xbrl.org/formula/conformance/example','t:TypedDim1')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count( $result ) eq 1 and
         count( $result/* ) eq 1 and
         $result/*[1] instance of element(t:typedDim1Value,xs:string) and
         data( $result/*[1] ) instance of xs:string and
         $result/t:typedDim1Value eq 'dimVal1'
      </cfcn:test>
    </outputs>
  </variation>

  <revisions>
    <reg:revision on="2008-03-16T08:30:00" by="herm">
      <xhtml:p>
        Typed dimension testcase.
      </xhtml:p>
    </reg:revision>
    <reg:revision on="2008-09-01T00:00:00" by="herm">
      <xhtml:p>
        Made the function segment/scenario agnostic, renamed without segment/scenario in name.
      </xhtml:p>
    </reg:revision>
    <reg:revision on="2008-09-21T00:00:00" by="herm">
      <xhtml:p>
        Fixed V-09 and V-09, for segment/scenario ambivalence.
      </xhtml:p>
    </reg:revision>
    <reg:revision on="2008-11-16T00:00:00" by="herm">
      <xhtml:p>
        Fixed V-03 to empty result
      </xhtml:p>
    </reg:revision>
    <reg:revision on="2008-12-05T00:00:00" by="herm">
      <xhtml:p>
        Added data type verification.
      </xhtml:p>
    </reg:revision>
  </revisions>

</testcase>
